namespace Titarzhe\Design\Create;
//单例类
class Singleton
{
    //类的唯一实例
    private static _instance;
    //防止被外界创建实例
    protected function __construct(){

    }
    //防止被外界克隆
    private function __clone(){

    }
    //构建外界访问唯一实例的方法
    public static function getInstance(){
        //如果实例未创建，则创建一个实例
        if (!(self::_instance instanceof self)) {
            var called_class;
            let called_class = get_called_class();
        	let self::_instance = new {called_class}();
        }
        return self::_instance;
    }
}